#include "head.h"
//#include "../include/list.h"
//#include "../include/dlist.h"
//#include "../include/user.h"
//#include "../include/flight.h"

//用户及管理员信息
User_data u_data[MAX_INPUT_SIZE]=
{
    {.user_name="雷军",.password="12345678",.level_id=0}
};

//航班信息
f_data data[7] = 
{
    {1, "Boeing 737", "北京", "上海", {8, 30}, {10, 45}, "2小时15分", 800, 180, 180, 'n'},
    {2, "Airbus A320", "广州", "深圳", {9, 15}, {10, 00}, "45分钟", 400, 150, 140, 'n'},
    {3, "Boeing 787", "成都", "重庆", {11, 00}, {11, 50}, "50分钟", 500, 220, 200, 'n'},
    {4, "Airbus A330", "南京", "杭州", {13, 30}, {14, 30}, "1小时", 600, 200, 200, 'n'},
    {5, "Boeing 777", "上海", "北京", {15, 00}, {17, 10}, "2小时10分", 900, 240, 230, 'n'},
    {6, "Airbus A350", "深圳", "广州", {16, 45}, {17, 30}, "45分钟", 450, 160, 150, 'n'},
    {7, "Boeing 747", "西安", "武汉", {19, 00}, {20, 20}, "1小时20分", 700, 300, 290, 'n'}
};


void test_user(void)
{
    int flag=1;
    //用户的信息链表初始化
    link_list *User_List=init_link_list();
    link_list *Admin_List=init_link_list();

    //航班信息双向链表初始化
    f_list * list_f_1 = init_double_link_list();

    for(size_t i=0;i<sizeof(u_data) / sizeof(u_data[0]);i++)
    {
        if(u_data[i].level_id==Regular)
        {
            insert_link_node(User_List,u_data[i],1);
            user_data_file_print(User_List,REGULAR_FILE);
        }
        else if(u_data[i].level_id==silver_vip)
        {
            insert_link_node(User_List,u_data[i],1);
            user_data_file_print(User_List,SILVER_FILE);
        }
        else if(u_data[i].level_id==goldplatinum_vip)
        {
            insert_link_node(User_List,u_data[i],1);
            user_data_file_print(User_List,GOLD_FILE);
        }
        else if(u_data[i].level_id==platinum_vip)
        {
            insert_link_node(User_List,u_data[i],1);
            user_data_file_print(User_List,PLATINUM_FILE);
        }
        else
        {
            insert_link_node(Admin_List,u_data[i],1);
            user_data_file_print(User_List,ADMIN_FILE);
        }
        
    }
    while(flag)
    {
        system("clear");
        MENU(User_List,Admin_List,list_f_1);
    }
}


int main(int argc, char const *argv[])
{
    test_user();
    return 0;
}
